package bsts.view.customer;

import java.awt.BorderLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.JFrame;

import bsts.application.BSTSApplication;

public class AddCustomerWindow extends JFrame {

	private static final long serialVersionUID = 1L;

	private BSTSApplication manager;
	private JFrame container;
	private AddCustomerPanel addCustomerPanel;

	private WindowListener windowListener = new WindowAdapter() {
		public void windowClosing(WindowEvent e) {
			manager.getViewManager().goBackMain(container);
		}
	};

	public AddCustomerWindow(BSTSApplication manager) {
		super("BSTS - Register Customer");
		this.manager = manager;
		this.container = this;

		addCustomerPanel = new AddCustomerPanel(this, manager);

		this.setLayout(new BorderLayout());
		this.add(addCustomerPanel, BorderLayout.CENTER);
		this.addWindowListener(windowListener);
	}

}
